{if $full_page}
{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,listtable.js"}
<script type="text/javascript" src="../js/calendar.php"></script>
<script type="text/javascript" src="js/jPicker/jquery-1.4.4.min.js"></script>
<link href="../js/calendar/calendar.css" rel="stylesheet" type="text/css" />

<!-- 订单搜索 -->
<div class="form-div">
  <form action="javascript:searchOrder()" name="searchForm">
    <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />
    {$lang.order_sn}<input name="order_sn" type="text" id="order_sn" size="15">
    {$lang.consignee|escape}<input name="consignee" type="text" id="consignee" size="15">
	供应商
  <select name="suppliers_id" id="suppliers_id">
      <option value="0">全部供应商</option>
         {foreach from = $suppliers_list item = sitem}
      <option value={$sitem.suppliers_id}>{$sitem.suppliers_name}</option>
      {/foreach}
  </select>


    {$lang.all_status}
    <select name="status" id="status">
      <option value="-1">{$lang.select_please}</option>
      {html_options options=$status_list}
    </select>
	
	<script>
	   	
	function myFunction(){
      alert('ok');
	
    }
	</script>
	
	

	<!-- 新增y-6.27下单时间 -->
	
	
	<div style="margin:10px 30px;"><strong  style="    width: 120px;display: inline-block;">{$lang.label_time}</strong>
      <input type="text" class="time" name="start_time" maxlength="60" size="20" readonly="readonly" id="start_time_id" onchange=" myFunction();" />
      <input name="start_time_btn" type="button" id="start_time_btn"  onclick="return showCalendar('start_time_id', '%Y-%m-%d %H:%M', '24', false, 'start_time_btn'); " value="{$lang.btn_select}" class="button" />
      ~      
      <input type="text" class="time" name="end_time" maxlength="60" size="20" readonly="readonly" id="end_time_id" onchange="myFunction();" />
      <input name="end_time_btn" type="button" id="end_time_btn" onclick="return showCalendar('end_time_id', '%Y-%m-%d %H:%M', '24', false, 'end_time_btn');" value="{$lang.btn_select}" class="button" />
	
	<span id="qingchu" class="button Y-dele" onclick="">清除</span>
	
	</div>
	
	
	<!-- 新增y-6.27付款时间 -->

	<div style="margin:10px 30px;"><strong  style="width: 120px;display: inline-block;">{$lang.label_pay_time}</strong>
     
      <input type="text" class="time1" name="start_time_a" maxlength="60" size="20" readonly="readonly" id="start_time_id_1" onchange="return myFunction()" />
      <input name="start_time_btn" type="button" id="start_time_btn_1" onclick="return showCalendar('start_time_id_1', '%Y-%m-%d %H:%M', '24', false, 'start_time_btn_1');" value="{$lang.btn_select}" class="button"/>
      ~      
      <input type="text" class="time1" name="end_time_a" maxlength="60" size="20" readonly="readonly" id="end_time_id_1" onchange="myFunction()" />
      <input name="end_time_btn" type="button" id="end_time_btn_1" onclick="return showCalendar('end_time_id_1', '%Y-%m-%d %H:%M', '24', false, 'end_time_btn_1');" value="{$lang.btn_select}" class="button"/>
	
	<span class="button Y-dele" id="qingchu1" onclick="">清除</span>
	</div>
	
	
	<!-- 新增y-6.27供应商发货时间 -->
	

	<div style="margin:10px 30px;"><strong  style="width: 120px;display: inline-block;">{$lang.ghs_shipping_time}</strong>
      <input type="text" class="time2" name="start_time_b" maxlength="60" size="20" readonly="readonly" id="start_time_id_2"  onchange="myFunction()"/>
      <input name="start_time_btn" type="button" id="start_time_btn_2" onclick="return showCalendar('start_time_id_2', '%Y-%m-%d %H:%M', '24', false, 'start_time_btn_2');" value="{$lang.btn_select}" class="button"/>
      ~      
      <input type="text" class="time2" name="end_time_b" maxlength="60" size="20" readonly="readonly" id="end_time_id_2" onchange="myFunction()" />
      <input name="end_time_btn" type="button" id="end_time_btn_2" onclick="return showCalendar('end_time_id_2', '%Y-%m-%d %H:%M', '24', false, 'end_time_btn_2');" value="{$lang.btn_select}" class="button"/>
	
	<span class="button Y-dele" id="qingchu2" onclick="">清除</span>
	</div>
	
	
	<!-- 新增y-6.27支付货款时间 -->
	

	<div style="margin:10px 30px;"><strong  style="    width: 120px;display: inline-block;">{$lang.ghs_pay_time}</strong>
      <input type="text" class="time3" name="start_time_c" maxlength="60" size="20" readonly="readonly" id="start_time_id_3" onchange="myFunction()" />
      <input name="start_time_btn" type="button" id="start_time_btn_3" onclick="return showCalendar('start_time_id_3', '%Y-%m-%d %H:%M', '24', false, 'start_time_btn_3');" value="{$lang.btn_select}" class="button"/>
      ~      
      <input type="text" class="time3" name="end_time_c" maxlength="60" size="20" readonly="readonly" id="end_time_id_3" onchange="myFunction()" />
      <input name="end_time_btn"  type="button" id="end_time_btn_3" onclick="return showCalendar('end_time_id_3', '%Y-%m-%d %H:%M', '24', false, 'end_time_btn_3');" value="{$lang.btn_select}" class="button"/>

	  <span class="button Y-dele" id="qingchu3" onclick="">清除</span>
	</div>

	
	<!-- 新增6.27订单完成时间 -->
	
	
	<div style="margin:10px 30px;"><strong  style="    width: 120px;display: inline-block;">{$lang.ghs_wanc_time}</strong>
      <input type="text" class="time4" name="start_time_d" maxlength="60" size="20" readonly="readonly" id="start_time_id_4"  onchange="myFunction()"/>
      <input name="start_time_btn" type="button" id="start_time_btn_4" onclick="return showCalendar('start_time_id_4', '%Y-%m-%d %H:%M', '24', false, 'start_time_btn_4');" value="{$lang.btn_select}" class="button"/>
      ~      
      <input type="text" class="time4" name="end_time_d" maxlength="60" size="20" readonly="readonly" id="end_time_id_4" onchange="myFunction()"/>
      <input name="end_time_btn" type="button" id="end_time_btn_4" onclick="return showCalendar('end_time_id_4', '%Y-%m-%d %H:%M', '24', false, 'end_time_btn_4');" value="{$lang.btn_select}" class="button"/>

	  <span class="button Y-dele" id="qingchu4" onclick="">清除</span>
	  
	</div>

    <input type="submit" value="{$lang.button_search}" class="button" />
    <a href="order.php?act=list&composite_status={$os_unconfirmed}">{$lang.cs.$os_unconfirmed}</a>
    <a href="order.php?act=list&composite_status={$cs_await_pay}">{$lang.cs.$cs_await_pay}</a>
    <a href="order.php?act=list&composite_status={$cs_await_ship}">{$lang.cs.$cs_await_ship}</a>

	
  </form>
</div>

<!-- 订单列表 -->
<form method="post" action="order.php?act=operate" name="listForm" onsubmit="return check()">
  <div class="list-div" id="listDiv">
{/if}

<table cellpadding="3" cellspacing="1">
  <tr>
    <th>
      <input onclick='listTable.selectAll(this, "checkboxes")' type="checkbox" /><a href="javascript:listTable.sort('order_sn', 'DESC'); ">{$lang.order_sn}</a>{$sort_order_sn}
    </th>
    <th><a href="javascript:listTable.sort('add_time', 'DESC'); ">{$lang.order_time}</a>{$sort_order_time}</th>
    <th><a href="javascript:listTable.sort('consignee', 'DESC'); ">{$lang.consignee}</a>{$sort_consignee}</th>
	<th>供货商</th>
    <th><a href="javascript:listTable.sort('total_fee', 'DESC'); ">{$lang.total_fee}</a>{$sort_total_fee}</th>
	<th>进货价</th>
    <th><a href="javascript:listTable.sort('order_amount', 'DESC'); ">{$lang.order_amount}</a>{$sort_order_amount}</th>
    <th>{$lang.all_status}</th>
    <th>{$lang.handler}</th>
  <tr>
  {foreach from=$order_list item=order key=okey}
  <tr>
    <td valign="top" nowrap="nowrap"><input type="checkbox" name="checkboxes" value="{$order.order_sn}" /><a href="order.php?act=info&order_id={$order.order_id}" id="order_{$okey}">{$order.order_sn}{if $order.extension_code eq "group_buy"}<br /><div align="center">{$lang.group_buy}</div>{elseif $order.extension_code eq "exchange_goods"}<br /><div align="center">{$lang.exchange_goods}</div>{/if}</a></td>
    <td>{$order.buyer|escape}<br />{$order.short_order_time}</td>
    <td align="left" valign="top"><a href="mailto:{$order.email}"> {$order.consignee|escape}</a>{if $order.tel} [TEL: {$order.tel|escape}]{/if} <br />{$order.address|escape}</td>
    <td align="right" valign="top" nowrap="nowrap">{$order.suppliers_name}</td>
	<td align="right" valign="top" nowrap="nowrap">{$order.formated_total_fee}</td>
	<td align="right" valign="top" nowrap="nowrap">{$order.goods_jhprice}</td>
    <td align="right" valign="top" nowrap="nowrap">{$order.formated_order_amount}</td>
    <td align="center" valign="top" nowrap="nowrap">{$lang.os[$order.order_status]},{$lang.ps[$order.pay_status]},{$lang.ss[$order.shipping_status]}</td>
    <td align="center" valign="top"  nowrap="nowrap">
     <a href="order.php?act=info&order_id={$order.order_id}">{$lang.detail}</a>
     {if $order.can_remove}
     <br /><a href="javascript:;" onclick="listTable.remove({$order.order_id}, remove_confirm, 'remove_order')">{$lang.remove}</a>
     {/if}
    </td>
  </tr>
  {/foreach}
</table>

<!-- 分页 -->
<table id="page-table" cellspacing="0">
  <tr>
    <td align="right" nowrap="true">
    {include file="page.htm"}
    </td>
  </tr>
</table>

{if $full_page}
  </div>
  <div>
    <input name="confirm" type="submit" id="btnSubmit" value="{$lang.op_confirm}" class="button" disabled="true" onclick="this.form.target = '_self'" />
    <input name="invalid" type="submit" id="btnSubmit1" value="{$lang.op_invalid}" class="button" disabled="true" onclick="this.form.target = '_self'" />
    <input name="cancel" type="submit" id="btnSubmit2" value="{$lang.op_cancel}" class="button" disabled="true" onclick="this.form.target = '_self'" />
    <input name="remove" type="submit" id="btnSubmit3" value="{$lang.remove}" class="button" disabled="true" onclick="this.form.target = '_self'" />
    <input name="print" type="submit" id="btnSubmit4" value="{$lang.print_order}" class="button" disabled="true" onclick="this.form.target = '_blank'" />
		
	<!-- 导出订单功能开始 this.form.target = '_blank'-->
	<span class="button" onclick="exports();" style="padding: 2px 8px 2px;margin: 2px 2px;color: #fff;font-size: 12px;border: none;background: #c43926;-moz-border-radius: 3px;-webkit-border-radius: 3px;border-radius: 3px;position: relative;cursor: pointer;"/>导出订单</span>
	<!-- 导出订单功能结束 -->
	
    <input name="batch" type="hidden" value="1" />
    <input name="order_id" type="hidden" value="" />

  </div>
</form>
<script language="JavaScript">
listTable.recordCount = {$record_count};
listTable.pageCount = {$page_count};

{foreach from=$filter item=item key=key}
listTable.filter.{$key} = '{$item}';
{/foreach}
{literal}

    onload = function()
    {
        // 开始检查订单
        startCheckOrder();
    }


    /**
     * 搜索订单
     */
    function searchOrder()
    {
        listTable.filter['order_sn'] = Utils.trim(document.forms['searchForm'].elements['order_sn'].value);
		
        listTable.filter['consignee'] = Utils.trim(document.forms['searchForm'].elements['consignee'].value);
		
		listTable.filter['suppliers_id'] = document.forms['searchForm'].elements['suppliers_id'].value;
			
        listTable.filter['composite_status'] = document.forms['searchForm'].elements['status'].value;
		
		
		
		/*新增*/
		
		listTable.filter['start_time'] = document.forms['searchForm'].elements['start_time'].value;
		
		listTable.filter['end_time'] = document.forms['searchForm'].elements['end_time'].value;
		
		listTable.filter['start_time_a'] = document.forms['searchForm'].elements['start_time_a'].value;
		
		listTable.filter['end_time_a'] = document.forms['searchForm'].elements['end_time_a'].value;
		
		listTable.filter['start_time_b'] = document.forms['searchForm'].elements['start_time_b'].value;
		
		listTable.filter['end_time_b'] = document.forms['searchForm'].elements['end_time_b'].value;
		
		listTable.filter['start_time_c'] = document.forms['searchForm'].elements['start_time_c'].value;
		
		listTable.filter['end_time_c'] = document.forms['searchForm'].elements['end_time_c'].value;
		
		listTable.filter['start_time_d'] = document.forms['searchForm'].elements['start_time_d'].value;
		
		listTable.filter['end_time_d'] = document.forms['searchForm'].elements['end_time_d'].value;
		
        listTable.filter['page'] = 1;
        listTable.loadList();
    }

    function check()
    {
      var snArray = new Array();
      var eles = document.forms['listForm'].elements;
      for (var i=0; i<eles.length; i++)
      {
        if (eles[i].tagName == 'INPUT' && eles[i].type == 'checkbox' && eles[i].checked && eles[i].value != 'on')
        {
          snArray.push(eles[i].value);
        }
      }
      if (snArray.length == 0)
      {
        return false;
      }
      else
      {
        eles['order_id'].value = snArray.toString();
        return true;
      }
    }
    /**
     * 显示订单商品及缩图
     */
    var show_goods_layer = 'order_goods_layer';
    var goods_hash_table = new Object;
    var timer = new Object;

    /**
     * 绑定订单号事件
     *
     * @return void
     */
    function bind_order_event()
    {
        var order_seq = 0;
        while(true)
        {
            var order_sn = Utils.$('order_'+order_seq);
            if (order_sn)
            {
                order_sn.onmouseover = function(e)
                {
                    try
                    {
                        window.clearTimeout(timer);
                    }
                    catch(e)
                    {
                    }
                    var order_id = Utils.request(this.href, 'order_id');
                    show_order_goods(e, order_id, show_goods_layer);
                }
                order_sn.onmouseout = function(e)
                {
                    hide_order_goods(show_goods_layer)
                }
                order_seq++;
            }
            else
            {
                break;
            }
        }
    }
    listTable.listCallback = function(result, txt) 
    {
        if (result.error > 0) 
        {
            alert(result.message);
        }
        else 
        {
            try 
            {
                document.getElementById('listDiv').innerHTML = result.content;
                bind_order_event();
                if (typeof result.filter == "object") 
                {
                    listTable.filter = result.filter;
                }
                listTable.pageCount = result.page_count;
            }
            catch(e)
            {
                alert(e.message);
            }
        }
    }
    /**
     * 浏览器兼容式绑定Onload事件
     *
     */
    if (Browser.isIE)
    {
        window.attachEvent("onload", bind_order_event);
    }
    else
    {
        window.addEventListener("load", bind_order_event, false);
    }

    /**
     * 建立订单商品显示层
     *
     * @return void
     */
    function create_goods_layer(id)
    {
        if (!Utils.$(id))
        {
            var n_div = document.createElement('DIV');
            n_div.id = id;
            n_div.className = 'order-goods';
            document.body.appendChild(n_div);
            Utils.$(id).onmouseover = function()
            {
                window.clearTimeout(window.timer);
            }
            Utils.$(id).onmouseout = function()
            {
                hide_order_goods(id);
            }
        }
        else
        {
            Utils.$(id).style.display = '';
        }
    }

    /**
     * 显示订单商品数据
     *
     * @return void
     */
    function show_order_goods(e, order_id, layer_id)
    {
        create_goods_layer(layer_id);
        $layer_id = Utils.$(layer_id);
        $layer_id.style.top = (Utils.y(e) + 12) + 'px';
        $layer_id.style.left = (Utils.x(e) + 12) + 'px';
        if (typeof(goods_hash_table[order_id]) == 'object')
        {
            response_goods_info(goods_hash_table[order_id]);
        }
        else
        {
            $layer_id.innerHTML = loading;
            Ajax.call('order.php?is_ajax=1&act=get_goods_info&order_id='+order_id, '', response_goods_info , 'POST', 'JSON');
        }
    }

    /**
     * 隐藏订单商品
     *
     * @return void
     */
    function hide_order_goods(layer_id)
    {
        $layer_id = Utils.$(layer_id);
        window.timer = window.setTimeout('$layer_id.style.display = "none"', 500);
    }

    /**
     * 处理订单商品的Callback
     *
     * @return void
     */
    function response_goods_info(result)
    {
        if (result.error > 0)
        {
            alert(result.message);
            hide_order_goods(show_goods_layer);
            return;
        }
        if (typeof(goods_hash_table[result.content[0].order_id]) == 'undefined')
        {
            goods_hash_table[result.content[0].order_id] = result;
        }
        Utils.$(show_goods_layer).innerHTML = result.content[0].str;
    }
	
	
	/*20170628  YZ */
	function exports(){
	
	  /*获取搜索框的值*/
	    var order_sn = Utils.trim(document.forms['searchForm'].elements['order_sn'].value);
        var consignee = Utils.trim(document.forms['searchForm'].elements['consignee'].value);
		var suppliers_id = document.forms['searchForm'].elements['suppliers_id'].value;	
        var composite_status = document.forms['searchForm'].elements['status'].value;
		
		var order_status = listTable.filter['order_status'];
		
	
		
		/*新增*/
		var start_time = document.forms['searchForm'].elements['start_time'].value;
		
		var end_time = document.forms['searchForm'].elements['end_time'].value;
		
		var start_time_a = document.forms['searchForm'].elements['start_time_a'].value;
		
		var end_time_a = document.forms['searchForm'].elements['end_time_a'].value;
		
		var start_time_b = document.forms['searchForm'].elements['start_time_b'].value;
		
		var end_time_b = document.forms['searchForm'].elements['end_time_b'].value;
		
		var start_time_c = document.forms['searchForm'].elements['start_time_c'].value;
		
		var end_time_c = document.forms['searchForm'].elements['end_time_c'].value;
		
		var start_time_d = document.forms['searchForm'].elements['start_time_d'].value;
		
		var end_time_d = document.forms['searchForm'].elements['end_time_d'].value;
	
	
	
	
	
	   /*链接组合*/
	   var urls = "export.php?act=order_export&order_sn="+order_sn+"&consignee="+consignee+"&suppliers_id="+suppliers_id+"&composite_status="+composite_status+"&start_time="+start_time+"&end_time="+end_time+"&start_time_a="+start_time_a+"&end_time_a="+end_time_a+"&start_time_b="+start_time_b+"&end_time_b="+end_time_b+"&start_time_c="+start_time_c+"&end_time_c="+end_time_c+"&start_time_d="+start_time_d+"&end_time_d="+end_time_d+"&order_status="+order_status;
	   
	   /*跳转链接*/
	   //window.location.href = urls;
	   window.open(urls);
	
	
	}
/*清除时间段*/
	$(function(){ 
		function qingchu(id,clas){
		
		 $('#'+id).click(function(){  
		 
		 $('.'+clas).val(""); 
	 
		 
		});
		}
			qingchu('qingchu','time');
			qingchu('qingchu1','time1');
			qingchu('qingchu2','time2');
			qingchu('qingchu3','time3');
			qingchu('qingchu4','time4');
	    
	});  

</script>
{/literal}

{include file="pagefooter.htm"}
{/if}